
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet"
	href="lib/webuploader/webuploader.css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"/>
<link href="css/colorpicker.css" rel="stylesheet"/>
<link href="css/layout.css" rel="stylesheet"/>
<link href="css/common.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<style>
.file-bottom {
	position: relative;
}

.file-form {
	position: absolute;
	top: 0;
}
</style>
<title>新增商品</title>
</head>
<body>
	<div class="pd-20">
		<form action="<%=path%>/backstage/goods-add" method="post"
			class="form form-horizontal" id="form-goods-add">

			<div class="info-con">
				<span class="hr-info">基本信息</span>&nbsp;&nbsp;&nbsp;&nbsp;
				<c:if test="${ !empty goods}">
					<a class="btn btn-primary radius" style="margin-bottom: 5px;"
						onclick="updateStatus(1);" href="javascript:;">上架</a>
					<a class="btn btn-primary radius" style="margin-bottom: 5px;"
						onclick="updateStatus(2);" href="javascript:;">下架</a>
					<a class="btn btn-primary radius" style="margin-bottom: 5px;"
						onclick="updateStatus(0);" href="javascript:;">临时冻结</a>
				</c:if>
			</div>

			<%-- <div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>所在县市：</label>
				<div class="formControls col-2">
					<span class="select-box"> <select name="city_id"
						class="select" onchange="ciytChange(this);" datatype="n"
						nullmsg="请选择县市">
							<option value="-1">--所在县市--</option>
							<c:forEach items="${citys}" var="city">
								<option value="${city.id}"
									<c:if test="${city.id==goods.city_id}">selected</c:if>>${city.name}</option>
							</c:forEach>
					</select>
					</span>
				</div>
				<label class="form-label col-2"><span class="c-red">*</span>所属商铺：</label>
				<div class="formControls col-2">
					<span class="select-box"> <select name="shop_id" id="shops"
						class="select" datatype="n" nullmsg="请选择商铺">
							<option value="-1">--所属商铺--</option>
							<c:forEach items="${shops}" var="shop">
								<option value="${shop.cId}"
									<c:if test="${shop.cId==goods.shop_id}">selected</c:if>>${shop.cSname}</option>
							</c:forEach>
					</select>
					</span>
				</div>
			</div> --%>

			<div class="row cl">
				<input type="hidden" id="id" name="id" value='${goods.id}' />
				<c:if test="${1 == goods.is_deleted}">
					<div>
						<label class="form-label col-2"><span class="c-red"></span>状态：</label>
						<div class="formControls col-2">
							<span class="select-box"> <select name="is_deleted"
								class="select">
									<option value="0">未删除</option>
									<option value="1" selected="selected">已删除</option>
							</select>
							</span>
						</div>
						<div style="clear: both;">
							<br>
						</div>
					</div>
				</c:if>
				<c:if test="${0 == goods.is_deleted}">
					<input type="hidden" name="is_deleted" value="0">
				</c:if>
			</div>
			<div class="row cl">
				<label class="form-label col-2">企业主：</label>
				<div class="formControls col-2">
					<span class="select-box"><select name="ent_id"
						class="select" datatype="*" nullmsg="请选择类型">
							<c:forEach items="${entrepreneurs}" var="entrepreneur">
								<option value="${entrepreneur.user_id}"
								<c:if test="${entrepreneur.user_id==goods.userId}">selected</c:if>
								>${entrepreneur.corp_fname}</option>
							</c:forEach>
					</select></span>
				</div>
				
				<label class="form-label col-2"><span class="c-red">*</span>名称：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${goods.name}"
						placeholder="" id="" name="name" datatype="*" nullmsg="不能为空">
				</div>
				
				<label class="form-label col-2"><span class="c-red">*</span>排序值：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text"
						value="${empty goods.sort ? 0 : goods.sort}" placeholder="" id=""
						name="sort">
				</div>
			</div>

			<div class="row cl">
				<input type="hidden" name="type" id="endType" value="${goods.type}">
				<label class="form-label col-2"><span class="c-red">*</span>所属品类：</label>
				<div class="formControls col-2">
					<span class="select-box"> <select class="select" id="type1"
						onchange="firstChange(this);">
							<option value="-1">--大类--</option>
							<c:forEach items="${types1}" var="type">
								<option value="${type.cCode}"
									<c:if test="${type.cCode==firstType.cCode}">selected</c:if>>${type.cName}</option>
							</c:forEach>
					</select>
					</span>
				</div>
				<div class="formControls col-2">
					<span class="select-box"> <select class="select" id="type2"
						onchange="secondChange(this);" onclick="secondClick(this)">
							<option value="-1">--中类--</option>
							<c:forEach items="${types2}" var="type">
								<option value="${type.cCode}"
									<c:if test="${type.cCode==sencondType.cCode}">selected</c:if>>${type.cName}</option>
							</c:forEach>
					</select>
					</span>
				</div>
				<div class="formControls col-2">
					<span class="select-box"> <select class="select" id="type3"
						onclick="thirdClick(this)">
							<option value="-1">--小类--</option>
							<c:forEach items="${types3}" var="type">
								<option value="${type.cCode}"
									<c:if test="${type.cCode==thiredType.cCode}">selected</c:if>>${type.cName}</option>
							</c:forEach>
					</select>
					</span>
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>最小购买数</label>
				<div class="formControls col-2">
					<input type="text" class="input-text"
						value="${empty goods.mini_buy ?  1 : goods.mini_buy}"
						placeholder="" id="" name="mini_buy" datatype="*" nullmsg="不能为空">
				</div>
				<label class="form-label col-2"><span class="c-red">*</span>已售数量</label>
				<div class="formControls col-2">
					<input type="text" class="input-text"
						value="${empty soldCount ? 0 : soldCount}" placeholder="" id=""
						name="count">
				</div>
				<label class="form-label col-2">产地：</label>
				<div class="formControls col-2">
					<input type="text" name="producing_area" id="" placeholder=""
						value="${goods.producing_area}" class="input-text">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">品牌：</label>
				<div class="formControls col-2">
					<span class="select-box"> <select class="select"
						id="brand_id" name="brand_id">
							<option value="-1">--请选择品牌--</option>
							<c:forEach items="${brandList}" var="brand">
								<option value="${brand.brand_id}"
									<c:if test="${brand.brand_id==goods.brand_id}">selected</c:if>>${brand.brand_name}</option>
							</c:forEach>
					</select>
					</span>
				</div>
				<label class="form-label col-2"><span class="c-red">*</span>价格</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${goods.price}"
						placeholder="" id="" name="price">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">是否支持团购：</label>
				<div class="formControls col-2">
					<span class="select-box"> <select class="select" id=""
						name="group_flag">
							<option <c:if test="${goods.group_flag==1}">selected</c:if>
								value="1">支持</option>
							<option <c:if test="${goods.group_flag==0}">selected</c:if>
								value="0">不支持</option>
					</select>
					</span>
				</div>
				<label class="form-label col-2">文字背景色</label>
				<div class="formControls col-2">
					<input type="text" maxlength="6" size="6" class="input-text"  id="colorpickerField1"  name="col_img" value="${goods.col_img}" />
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">商品标签：</label>
				<div class="formControls col-10" style="text-align:left;">
					<c:forEach items="${taglist}" var="tag">
						<input type="checkbox"
							<c:if test="${tag.is_select==1}">checked="checked"</c:if>
							value="${tag.gtag_id}" name="goodstags" height="150" >&nbsp;${tag.gtag_title}&nbsp;&nbsp;
					</c:forEach>
				</div>
			</div>

			<div class="info-con to-top">
				<span class="hr-info">货品规格</span> &nbsp;&nbsp;&nbsp;&nbsp;<a
					class="btn btn-primary radius" style="margin-bottom: 5px;"
					onclick="addProduct();" href="javascript:;">添加</a>
			</div>
			<div class="row cl">
				<!-- <label class="form-label col-2">商品规格：</label> -->
				<div class="formControls" id="productCtn">
					<input type="hidden" id="products_list" name="products_list"
						value="" />

					<c:forEach items="${products}" var="product" varStatus="varStatus">
						<div class="rule-con">

							货品${varStatus.count}：<span class="c-red">*</span>市场价&nbsp;&nbsp;<input
								type="text" name="${varStatus.count}_mkt"
								id="${varStatus.count}_mkt" placeholder="市场价"
								value="${product.mkt_price}"
								<c:if test="${varStatus.count==1}">datatype="/^[\d\.]+$/" nullmsg="不能为空"</c:if>
								class="input-text" style="width: 10%">&nbsp;元&nbsp;&nbsp;
							<span class="c-red">*</span>销售价&nbsp;&nbsp;<input type="text"
								name="${varStatus.count}_price" id="${varStatus.count}_price"
								<c:if test="${varStatus.count==1}">datatype="/^[\d\.]+$/" nullmsg="不能为空"</c:if>
								placeholder="销售价" value="${product.price}" class="input-text"
								style="width: 10%">&nbsp;元&nbsp;&nbsp; <span
								class="c-red">*</span>规格描述&nbsp;&nbsp;<input type="text"
								name="${varStatus.count}_pdt_spec"
								id="${varStatus.count}_pdt_spec"
								<c:if test="${varStatus.count==1}">datatype="*" nullmsg="不能为空"</c:if>
								placeholder="示例: 500ML" value="${product.pdt_spec}"
								class="input-text" style="width: 10%">&nbsp;&nbsp; <span
								class="c-red">*</span>库存&nbsp;&nbsp;<input type="text"
								name="${varStatus.count}_store" id="${varStatus.count}_store"
								<c:if test="${varStatus.count==1}">datatype="n" nullmsg="不能为空"</c:if>
								placeholder="库存" value="${product.store}" class="input-text"
								style="width: 5%">&nbsp;&nbsp; <span class="c-red">*</span>单位&nbsp;&nbsp;<input
								type="text" name="${varStatus.count}_unit"
								id="${varStatus.count}_unit"
								<c:if test="${varStatus.count==1}">datatype="*" nullmsg="不能为空"</c:if>
								placeholder="单位" value="${product.unit}" class="input-text"
								style="width: 10%"> <input type="hidden"
								name="${varStatus.count}_productId"
								id="${varStatus.count}_productId" value="${product.product_id}">
							<span class="c-red">*</span><%-- 城市&nbsp;&nbsp;<select
								name="${varStatus.count}_city_id"
								id="${varStatus.count}_city_id" class="select"
								style="width: 10%" datatype="n" nullmsg="请选择县市">
								<c:forEach items="${citys}" var="city">
									<option value="${city.id}"
										<c:if test="${city.id==product.city_id}">selected</c:if>>${city.name}</option>
								</c:forEach>
							</select> --%> <a style="text-decoration: none" class="btn btn-primary radius"
								onClick="product_disable(this,'${product.product_id}')"
								href="javascript:;" title="删除">删除</a>
						</div>
					</c:forEach>
					<c:if test="${empty products}">
						<div class="rule-con">
							规格1：<span class="c-red">*</span>市场价&nbsp;&nbsp;<input type="text"
								name="1_mkt" id="1_mkt" placeholder="市场价" value=""
								class="input-text" style="width: 10%" datatype="/^[\d\.]+$/"
								nullmsg="不能为空">&nbsp;元&nbsp;&nbsp; <span class="c-red">*</span>销售价&nbsp;&nbsp;<input
								type="text" name="1_price" id="1_price" placeholder="销售价"
								value="${product.price}" class="input-text" style="width: 10%"
								datatype="/^[\d\.]+$/" nullmsg="不能为空">&nbsp;元&nbsp;&nbsp;
							<span class="c-red">*</span>规格描述&nbsp;&nbsp;<input type="text"
								name="1_pdt_spec" id="1_pdt_spec" placeholder="示例: 500ML"
								value="${product.pdt_spec}" class="input-text"
								style="width: 10%" datatype="*" nullmsg="不能为空">&nbsp;&nbsp;
							<span class="c-red">*</span>库存&nbsp;&nbsp;<input type="text"
								name="1_store" id="1_store" placeholder="库存"
								value="${product.store}" class="input-text" style="width: 5%"
								datatype="n" nullmsg="不能为空">&nbsp; <span class="c-red">*</span>单位&nbsp;&nbsp;<input
								type="text" name="1_unit" id="1_unit" placeholder="单位"
								value="${product.unit}" class="input-text" style="width: 10%"
								datatype="*" nullmsg="不能为空"> <input type="hidden"
								name="1_productId" id="1_productId" value="0"> <a
								style="text-decoration: none" class="btn btn-primary radius"
								onClick="deleteProductForm(this);" href="javascript:;"
								title="删除">删除</a>
						</div>
					</c:if>
				</div>
			</div>


			<div class="info-con to-top">
				<span class="hr-info">图片和描述</span>
			</div>
			<div class="row cl">
				<label class="form-label col-2">商品描述：</label>
				<div class="formControls col-10">
					<textarea name="description" cols="" rows="" class="textarea"
						placeholder="说点什么...最少输入10个字符" datatype="*0-200" dragonfly="true"
						nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">${goods.description}</textarea>
					<p class="textarea-numberbar">
						<em class="textarea-length">0</em>/200
					</p>
				</div>
			</div>
			<%-- <div class="row cl">
				<label class="form-label col-2"></label>
				<div class="formControls col-10">
					<c:if test="${!empty goods.image }">
						<img src="<%=imagePath%>${goods.image}" height="50" border="0" />
					</c:if>
				</div>
			</div> --%>
			<div class="row cl" id="uploader">
				<label class="form-label col-2"><span class="c-red">*</span>缩略图：</label>
				<div class="formControls col-5">
					<div id="uploadbutton_pic">
					<c:if test="${!empty goods.image }">
						<img src="<%=imagePath%>${goods.image}" height="50" border="0" />
					</c:if>
					</div>	
					<button id="uploadbutton">选择图片上传</button>
				</div>
			</div>
			<input type="hidden" id="image" name="image" value="${goods.image}" />

			<div class="row cl">
				<c:if test="${!empty images}">
					<label class="form-label col-2">已有的商品介绍图：</label>
				</c:if>
				<div class="formControls col-10">
					<c:forEach items="${images}" var="image" varStatus="varStatus">
						<div id="image_${image.id}"
							style="float: left; margin-right: 5px;">
							<div>
								<img src="<%=imagePath%>${image.path}" alt="${image.id}"
									height="50" border="0" /> <input type="hidden"
									id="image_path_${image.id}" value="${image.path}" />
							</div>
							<div class="mt-5">
								<button onClick="goods_p_delete(this, ${image.id});"
									class="btn btn-primary radius" type="button">删除</button>
							</div>
						</div>
					</c:forEach>
				</div>
			</div>

			<input type="hidden" id="image_list" name="image_list"
				value="${image_list}" /> <input type="hidden" id="image_list_del"
				name="image_list_del" value="" />

			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>商品介绍图：</label>
				<div class="formControls col-5">
					<div class="uploader-list-container">
						<div class="queueList">
							<div id="dndArea" class="placeholder">
								<div id="filePicker-2"></div>
								<p>或将照片拖到这里，单次最多可选300张</p>
							</div>
						</div>
						<div class="statusBar" style="display: none;">
							<div class="progress">
								<span class="text">0%</span> <span class="percentage"></span>
							</div>
							<div class="info"></div>
							<div class="btns">
								<div id="filePicker2"></div>
								<div class="uploadBtn">开始上传</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">商品属性：</label>
				<div class="formControls col-10">
					<textarea name="property" cols="" rows="" class="textarea"
						placeholder="说点什么...最少输入10个字符" datatype="*0-200" dragonfly="true"
						onKeyUp="textarealength(this,200)">${goods.property}</textarea>
					<p class="textarea-numberbar">
						<em class="textarea-length">0</em>/200
					</p>
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">商品销售状态 ：</label>
				<div class="formControls col-4">
					<c:if test="${empty goods.status}">
						<input type="radio" name="status" value="1" id="s1"
							checked="checked">
						<label for="s1">出售中</label>
						<input type="radio" name="status" value="2" id="s2">
						<label for="s2">下架区</label>
						<input type="radio" name="status" value="0" id="s3">
						<label for="s3">仓库中</label>
					</c:if>
					<c:if test="${! empty goods.status}">
						<input type="radio" name="status" value="1" id="s1"
							<c:if test="${goods.status==1}">checked</c:if>>
						<label for="s1">出售中</label>
						<input type="radio" name="status" value="2" id="s2"
							<c:if test="${goods.status==2}">checked</c:if>>
						<label for="s2">下架区</label>
						<input type="radio" name="status" value="0" id="s3"
							<c:if test="${goods.status==0}">checked</c:if>>
						<label for="s3">仓库中</label>
					</c:if>

				</div>
			</div>
			<button onClick="goods_save_submit();" id="save-btn"
				class="btn btn-primary radius" type="submit" style="display: none;">
				<i class="Hui-iconfont">&#xe632;</i> 保存并提交审核
			</button>

		</form>

		<div class="mt-20">
			<div class="row cl">
				<label class="form-label col-2 text-r">商品图片详情：</label>
				<div class="uploaded f-l col-10" id="uploaded">
					<ul class="file-con" id="file-con">
						<!-- detailPics 商品详情 -->
						<c:forEach items="${detailPics}" var="image" varStatus="varStatus">

							<li class="f-l pic-con mr-10"><img
								src='<%=imagePath%>${image.path}'><br />
								<button onclick="deleteDetailPic(this, ${image.id});"
									class="btn btn-primary radius" type="button">删除</button></li>

						</c:forEach>
					</ul>
					<div class="cl"></div>
				</div>
				<div class="cl"></div>
				<label class="form-label col-2 mt-10"></label>
				<form onsubmit="return false;"
					action="<%=path%>/backstage/goods-smallpic-upload" method="post"
					id="fileForm" enctype="multipart/form-data">
					<div class="formControls col-10 mt-10">
						<span class="btn-upload"> <a href="javascript:void();"
							class="btn btn-primary radius">浏览文件</a> <input type="file"
							id="fileSelect" name="file" class="input-file"
							onchange="fileChange(this)">
						</span>
					</div>
				</form>
			</div>

			<div class="row cl mt-20">
				<div class="col-10 col-offset-2">
					<button onClick="goods_save();" id="goods-btn"
						class="btn btn-primary radius" type="button">
						<i class="Hui-iconfont">&#xe632;</i> 保存
					</button>
					<button onClick="layer_close();" class="btn btn-default radius"
						type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>

		</div>

		<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
		<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
		<script type="text/javascript"
			src="lib/Validform/5.3.2/Validform.min.js"></script>
		<script type="text/javascript"
			src="lib/webuploader/0.1.5/webuploader.min.js"></script>
		<script type="text/javascript"
			src="lib/ueditor/1.4.3/ueditor.config.js"></script>
		<script type="text/javascript"
			src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
		<script type="text/javascript" src="js/H-ui.js"></script>
		<script type="text/javascript" src="js/H-ui.admin.js"></script>
		<script type="text/javascript" src="js/jquery.form.js"></script>
		<script type="text/javascript" src="js/colorpicker.js"></script>
		<script type="text/javascript" src="js/eye.js"></script>
    	<script type="text/javascript" src="js/utils.js"></script>
    	<script type="text/javascript" src="js/layout.js?ver=1.0.2"></script>
    
<script type="text/javascript">
		var base_path = '<%=path%>';
		var rootPath  = '<%=imagePath%>';
		var productSize = ${productSize};
	</script>
	<script type="text/javascript" src="js/good_add.js"></script>
</body>
</html>